import request from "./request";
import { ICartList } from "../store/modules/cartStore";

export interface GetCartAns {
    code: number;
    msg: string;
    data: Array<any | ICartList>
}
export const getCart = () => {
    return request({
        url: '/cart/getCart',
        method: 'get'
    })
}

export interface AddGoodAns {
    code: number;
    msg: string;
}
export const addGood = (goodId: number,goodName: string,goodCount: number,goodcover: string,goodMethod: string,goodColor: string,goodSize: string,goodPrice: number) => {
    return request({
        url: '/cart/addCart',
        method: 'post',
        data: {
            goodId,
            goodName,
            goodCount,
            goodcover,
            goodMethod,
            goodColor,
            goodSize,
            goodPrice
        }
    })
}

export const updateCount = (cId: string,num: number) => {
    return request({
        url: '/cart/updateCount',
        method: 'put',
        data: {
            cId,
            num
        }
    })
}